// Author: wsfuyibing <682805@qq.com>
// Date: 2025-06-12

package responses

import (
	"server/app/http/models"
	"server/app/kind"
)

// ArcadeResponse
// 钓场信息.
type ArcadeResponse struct {
	Id           kind.ArcadeId       `label:"钓场ID"`
	Balance      kind.Balance        `label:"账户余额"`
	Verified     kind.ArcadeVerified `label:"认证状态位"`
	VerifiedFlag string              `label:"认证标记"`
	VerifiedText string              `label:"认证状态文本"`
	VerifiedYes  bool                `label:"已认证标记"`
	Page         string              `label:"详情页地址"`

	AdminCount  int `label:"管理员数量"`
	FollowCount int `label:"关注人数"`

	TicketTotal int `label:"渔票总数"`
	TicketCount int `label:"渔票在售数"`

	PondCount int `label:"鱼塘数量"`
	PondTotal int `label:"鱼塘总数"`

	MemberCount       int
	MemberTotal       int
	MemberEnabled     kind.Enabled
	MemberEnabledFlag string
	MemberEnabledText string
	MemberEnabledYes  bool

	ShopCount       int
	ShopTotal       int
	ShopEnabled     kind.Enabled
	ShopEnabledFlag string
	ShopEnabledText string
	ShopEnabledYes  bool
	ShopDistance    int

	Latitude  kind.GeoPoint
	Longitude kind.GeoPoint
	Name      string
	Logo      string
	Address   string
	Setting   *ArcadeSettingResponse `json:",omitempty"`
}

// With
// 数据绑定.
func (o *ArcadeResponse) With(m *models.Arcades) *ArcadeResponse {
	o.Id = m.Id
	o.Verified = m.Verified
	o.VerifiedFlag = m.Verified.Flag()
	o.VerifiedText = m.Verified.Text()
	o.VerifiedYes = m.Verified.IsVerified()
	o.Page = "arcade.detail"

	o.Balance = m.Balance
	o.AdminCount = m.AdminCount
	o.FollowCount = m.FollowCount
	o.TicketTotal = m.TicketTotal
	o.TicketCount = m.TicketCount

	o.PondCount = m.PondCount
	o.PondTotal = m.PondTotal

	o.MemberCount = m.MemberCount
	o.MemberTotal = m.MemberTotal
	o.MemberEnabled = m.MemberEnabled
	o.MemberEnabledFlag = m.MemberEnabled.Flag()
	o.MemberEnabledText = m.MemberEnabled.Text()
	o.MemberEnabledYes = m.MemberEnabled.IsYes()

	o.ShopCount = m.ShopCount
	o.ShopTotal = m.ShopTotal
	o.ShopEnabled = m.ShopEnabled
	o.ShopEnabledFlag = m.ShopEnabled.Flag()
	o.ShopEnabledText = m.ShopEnabled.Text()
	o.ShopEnabledYes = m.ShopEnabled.IsYes()
	o.ShopDistance = m.ShopDistance

	o.Latitude = m.Latitude
	o.Longitude = m.Longitude
	o.Name = m.Name
	o.Logo = m.Logo
	o.Address = m.Address
	return o
}

// WithSetting
// 绑定设置.
func (o *ArcadeResponse) WithSetting(m *models.ArcadeSetting) *ArcadeResponse {
	if m != nil {
		o.Setting = (&ArcadeSettingResponse{}).With(m)
	}
	return o
}
